import com.it.rabbitQM.RabbitMQProducerMain;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * projectName: spring_boot_RabbitQM
 *
 * @author: 王宝贵
 * time: 2024/9/10 19:13 周二
 * description: 工作队列模式
 */
@SpringBootTest(classes = RabbitMQProducerMain.class)
public class RabbitMQ001 {


    @Autowired
    private RabbitTemplate rabbitTemplate;

    public static final String EXCHANGE_DIRECT = "";
    public static final String ROUTING_KEY_WORK = "atguigu.queue.work";

    @Test
    public void testSendMessageWork() {
        for (int i = 0; i < 10; i++) {
            rabbitTemplate.convertAndSend(
                    EXCHANGE_DIRECT,
                    ROUTING_KEY_WORK,
                    "Hello atguigu2222 " + i);
        }
    }


}